﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GanagroLiteData;
using System.Data;
using GeneralUtilities;

namespace GanagroLiteBO
{
    public class LookupsPresenter
    {
        private static BindingListView<ListItem> _colores;
        public static BindingListView<ListItem> Getcolores()
        {
            if (_colores != null)
            { return _colores;  }

            using (GlContext glc = new GlContext())
            {
                _colores = new BindingListView<ListItem>(glc.COLORES.Select(wp => new ListItem() {Id = wp.ID, Description = wp.DESCRIPCION }).ToList());
            }

            return _colores;
        }

        private static BindingListView<ListItem> _estados;
        public static BindingListView<ListItem> Getestados()
        {
            if (_estados != null)
            { return _estados; }

            using (GlContext glc = new GlContext())
            {
                _estados = new BindingListView<ListItem>(glc.ESTADOS.Select(wp => new ListItem() { Id = wp.ID, Description = wp.DESCRIPCION }).ToList());
            }

            return _estados;
        }

        private static BindingListView<ListItem> _razas;
        public static BindingListView<ListItem> Getrazas()
        {
            if (_razas != null)
            { return _razas; }

            using (GlContext glc = new GlContext())
            {
                _razas = new BindingListView<ListItem>(glc.RAZAS.Select(wp => new ListItem() { Id = wp.ID, Description = wp.DESCRIPCION }).ToList());
            }

            return _razas;
        }

        private static BindingListView<ListItem> _lotes;
        public static BindingListView<ListItem> Getlotes()
        {
            if (_lotes != null)
            { return _lotes; }

            using (GlContext glc = new GlContext())
            {
                _lotes = new BindingListView<ListItem>(glc.LOTES.Select(wp => new ListItem() { Id = wp.ID, Description = wp.DESCRIPCION }).ToList());
            }

            return _lotes;
        }
    }
}
